/* ************************************************************************

   qooxdoo - the new era of web development

   http://qooxdoo.org

   Copyright:
     2007-2008 1&1 Internet AG, Germany, http://www.1und1.de

   License:
     LGPL: http://www.gnu.org/licenses/lgpl.html
     EPL: http://www.eclipse.org/org/documents/epl-v10.php
     See the LICENSE file in the project's top-level directory for details.

   Authors:
     * Fabian Jakobs (fjakobs)
     * Martin Wittemann (martinwittemann)

************************************************************************ */

/**
 * The BaseError class is the common superclass for all error classes in
 * qooxdoo.
 *
 * It has a comment and a fail message as members. The toString method returns
 * the comment and the fail message separated by a colon.
 */
qx.Class.define("qx.core.BaseError",
{
      extend : Error,


      /*
      *****************************************************************************
         CONSTRUCTOR
      *****************************************************************************
      */

      /**
       * @param comment {String} Comment passed to the assertion call
       * @param failMessage {String} Fail message provided by the assertion
       */
      construct : function(comment, failMessage)
      {
        Error.call(this, failMessage);

        this.__comment = comment || "";
        this.__msg = failMessage || "";
      },



      /*
      *****************************************************************************
         MEMBERS
      *****************************************************************************
      */

      members :
      {
        __comment : null,
        __msg : null,


        /**
         * Comment passed to the assertion call
         *
         * @return {String} The comment passed to the assertion call
         */
        getComment : function() {
          return this.__comment;
        },


        /**
         * Fail message provided by the assertion
         *
         * @return {String} Fail message provided by the assertion
         */
        message : function() {
          return this.__msg;
        },


        /**
         * Get the error message
         *
         * @return {String} The error message
         */
        toString : function() {
          return this.__comment + ": " + this.__msg;
        }

      }
    });
